package org.wak.scene
{
	import org.wak.baseoneonline.flash.geom.IntPoint;
	
	/**
	 *  XML Definition for the ActionSpot. 
	 * 
	 */	
	public class XMLActionSpotDefinition implements IActionSpotDefinition
	{
		private var mPosition:IntPoint = null ;
		
		private var mId:String = "" ;
		
		private var mName:String = "" ;
		
		private var mDescription:String = "" ;
		
		private var mShape:Array = null ;
		
		private var mInteractionPoint:IntPoint = null ;
		
		private var mInteractionBehaviour:String = "" ;
		
		private var mDefaultAction:String = "" ;
		
		private var mVisible:Boolean = false ;
		
		private var mEnabled:Boolean = true ;
		
		public function XMLActionSpotDefinition(pInput:XML)
		{
			mId = pInput.@id ; 
			mName = pInput.Name ;
			mVisible = pInput.@visible == "true" ? true : false ;
			mEnabled = pInput.@enabled == "false" ? false : true ;
			mDescription = pInput.Description ; 
			mPosition = new IntPoint( pInput.Position.@x, pInput.Position.@y );
			
			mShape = new Array();
			var fShapePoint:IntPoint = null ;
			for each( var point:XML in  pInput.Shape.IntPoint )
			{
				fShapePoint = new IntPoint( point.@x, point.@y );
				mShape.push( fShapePoint );
			}
			
			mInteractionPoint = new IntPoint( pInput.InteractionPoint.IntPoint.@x,pInput.InteractionPoint.IntPoint.@y); 
			mInteractionBehaviour = pInput.InteractionPoint.behaviour ;
			
			mDefaultAction = pInput.DefaultAction ;
		}

		public function get position():IntPoint
		{
			return mPosition;
		}
		
		public function get id():String
		{
			return mId;
		}
		
		public function get name():String
		{
			return mName;
		}
		
		public function get description():String
		{
			return mDescription;
		}
		
		public function get shape():Array
		{
			return mShape;
		}
		
		public function get interactionPoint():IntPoint 
		{
			return mInteractionPoint ;
		}
		
		public function get interactionBehaviour():String 
		{
			return mInteractionBehaviour
		}
		
		public function get defaultAction():String 
		{
			return mDefaultAction ;
		}
		
		public function get visible():Boolean 
		{
			return mVisible ;
		}
		
		public function get enabled():Boolean 
		{
			return mEnabled ;
		}
	}
}